Computers widely available today have many different architectures, each with their own instruction set. These architectures are upgraded and modified with each new generation of microprocessors, generally providing additional processing power. Unfortunately, as computer hardware is upgraded or replaced, the preexisting software, which was created at enormous cost and effort, may be rendered obsolete. Since the software was written for a previous instruction set architecture, it generally contains instructions which the new computer hardware does not understand. The resulting need to replace software whenever computer hardware is replaced is enormously expensive, both in capital costs and training costs for users.
One solution which is becoming increasingly practical is to emulate the previous architecture on the new architecture, running the preexisting software through the emulator. As instructions are obtained from the software during execution, they are replaced or modified to run natively by the emulator on the new architecture. Unfortunately, it is difficult to correctly process interrupts while emulating software on a computer with a non-native instruction set, because the instructions from the software typically are not replaced one-to-one with native instructions. Thus, a single instruction may be replaced with a series of several new instructions. When execution of the series of new instructions is interrupted by an interrupt, the emulated architecture may not be in a known state. Interrupts are asynchronous exceptional events, such as a timer tick or a peripheral transaction notification. These events are serviced by the interrupt-catching mechanism native to the emulated instruction set or virtual machine. This interrupt-catching mechanism expects to see the virtual machine in states which occur at native instruction boundaries. However, the emulated series of replacement instructions may not leave the virtual machine in an expected state if the series of replacement instructions is interrupted at a point which does not correspond to one of the original instruction boundaries.